package com.apes.auto.maintain.model;

import com.apes.auto.car.model.CarBrand;
import com.apes.auto.car.model.VehicleLabel;
import com.apes.auto.car.model.VehicleType;
import com.apes.framework.jpa.ApesBean;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * @ClassName MaintainPeriodApp
 * @Description ERP保养周期表
 * @Author pengyb
 * @Date 2019/8/8 14:46
 * @Version 1.0
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = MaintainPeriodApp.CONST_TABLE_NAME)
public class MaintainPeriodApp implements ApesBean {
    public static final String CONST_TABLE_NAME = "byzq_app";
    @Id
    @Column(name = "CXID", length = 32)
    @Comment("车型ID")
    private String CXID;


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CP", referencedColumnName = "id")
    @Comment("厂牌")
    private VehicleLabel CP;  //根据品牌和厂商

    @NotNull
    @Comment("品牌")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PP", referencedColumnName = "id")
    private CarBrand PP;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CX", referencedColumnName = "id")
    @Comment("车型")
    private VehicleType CX;

    @Column(name = "PZCXMC", length = 128)
    @Comment("配置车型名称")
    private String PZCXMC;

    @Column(name = "PLID", length = 16)
    @Comment("品类ID")
    private String PLID;

    @Column(name = "PLMC", length = 128)
    @Comment("品类名称")
    private String PLMC;

    @Column(name = "PJMCID", length = 128)
    @Comment("配件名称ID")
    private String PJMCID;

    @Column(name = "PJMC", length = 128)
    @Comment("配件名称")
    private String PJMC;

    @Column(name = "SJPJMC", length = 128)
    @Comment("涉及配件名称")
    private String SJPJMC;

    @Column(name = "PJYL", length = 32)
    @Comment("配件用量")
    private String PJYL;

    @Column(name = "LC", length = 128)
    @Comment("里程")
    private String LC;

    @Column(name = "SJ", length = 4)
    @Comment("时间")
    private String SJ;

    @Column(name = "JCYLX", length = 128)
    @Comment("基础油类型")
    private String JCYLX;

    @Column(name = "GG", length = 128)
    @Comment("规格")
    private String GG;

    @Column(name = "JYLX", length = 128)
    @Comment("机油类型")
    private String JYLX;

    @Column(name = "WSLQYTJBJ", length = 64)
    @Comment("WSLQYTJBJ")
    private String WSLQYTJBJ;


    @Column(name = "REMARK", length = 64)
    @Comment("备注")
    private String REMARK;


    @Column(name = "TS01", length = 36)
    @Comment("时间戳")
    private String TS01;

    @Column(name = "YXBJ", nullable = false, columnDefinition = "number(1,0) default 0")
    @Comment("有效标记")
    private boolean YXBJ = false; //0:无效/删除;1:有效
}
